/**
 * @function deleteUser
 * @return {[type]} [description]
 */


/**
 * [ description]
 * @param {[type]} data [description]
 * @return {[type]} [description]
 */
var modalDelete = (function (data) {
  var div_modal = $('#div-modal'),
    modal_header = $('#result-header'),
    modal_body = $('#result-body'),
    modal_footer = $('#result-footer');
  modal_header.html('Excluir usuário');
  modal_body.html('<p>Tem certeza que deseja excluir o usuário?</p>');
  modal_footer.html('<button id="modal-excluir" class="btn btn-inverse">Sim</button>\n\
    <button class="btn" data-dismiss="modal" aria-hidden="true">Não</button>');
  div_modal.modal('show');
});


/**
 * [ description]
 * @param {[type]} id [description]
 * @return {[type]} [description]
 */
var deleteUser = (function (data) {
  $.post(base_url('usuarios/ajax_excluir'), data, function (response) {
    if (response.success) {

    } else {

    }
  }, 'json');
});


/* Eventos */
$(document).on('click', '.excluir', function () {
  var data = $(this).data('id');
  modalDelete(data);
});

$(document).on('click', '#modal-excluir', function () {
  deleteUser(data);
});